<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <base data-ice="baseUrl" href="../../../">
  <title data-ice="title">TreeSet | jstreemap Library</title>
  <link type="text/css" rel="stylesheet" href="css/style.css">
  <link type="text/css" rel="stylesheet" href="css/prettify-tomorrow.css">
  <script src="script/prettify/prettify.js"></script>
  <script src="script/manual.js"></script>
<meta name="description" content="Associative containers (sets, maps) library for JavaScript, using red-black trees."><meta property="twitter:card" content="summary"><meta property="twitter:title" content="jstreemap Library"><meta property="twitter:description" content="Associative containers (sets, maps) library for JavaScript, using red-black trees."></head>
<body class="layout-container" data-ice="rootContainer">

<header>
  <a href="./">Home</a>
  
  <a href="identifiers.html">Reference</a>
  <a href="source.html">Source</a>
  
  <div class="search-box">
  <span>
    <img src="./image/search.png">
    <span class="search-input-edge"></span><input class="search-input"><span class="search-input-edge"></span>
  </span>
    <ul class="search-result"></ul>
  </div>
<a style="position:relative; top:3px;" href="https://github.com/Kirusi/jstreemap"><img width="20px" src="./image/github.png"></a></header>

<nav class="navigation" data-ice="nav"><div>
  <ul>
    
  <li data-ice="doc"><a data-ice="dirPath" class="nav-dir-path" href="identifiers.html#public">public</a><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/public/insertion-result.js~InsertionResult.html">InsertionResult</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/public/iterators.js~BaseIterator.html">BaseIterator</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/public/iterators.js~Iterator.html">Iterator</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/public/iterators.js~ReverseIterator.html">ReverseIterator</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/public/js-iterators.js~JsIterator.html">JsIterator</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/public/js-iterators.js~JsReverseIterator.html">JsReverseIterator</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/public/tree-map.js~TreeMap.html">TreeMap</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/public/tree-multimap.js~TreeMultiMap.html">TreeMultiMap</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/public/tree-multiset.js~TreeMultiSet.html">TreeMultiSet</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/src/public/tree-set.js~TreeSet.html">TreeSet</a></span></span></li>
</ul>
</div>
</nav>

<div class="content" data-ice="content"><div class="header-notice">
  <div data-ice="importPath" class="import-path"><pre class="prettyprint"><code data-ice="importPathCode">import {TreeSet} from &apos;<span><a href="file/src/public/tree-set.js.html#lineNumber37">jstreemap/src/public/tree-set.js</a></span>&apos;</code></pre></div>
  <span data-ice="access">public</span>
  <span data-ice="kind">class</span>
  
  
  
  <span data-ice="source">| <span><a href="file/src/public/tree-set.js.html#lineNumber37">source</a></span></span>
</div>

<div class="self-detail detail">
  <h1 data-ice="name">TreeSet</h1>

  

  
  
  
  
  
  
  
  
  

  
  
  <div class="description" data-ice="description"><p>TreeSet is a container that stores unique elements following a specific order.</p>
<p>In a TreeSet, the value of an element also identifies it (the value is itself the key),
and each value must be unique. The value of the elements in a TreeSet cannot be modified
once in the container (the elements are immutable), but they can be inserted or removed
from the container.</p>
<h2 id="container-properties">Container properties</h2><ul>
<li><strong>Associative</strong> - Elements in associative containers are referenced by their key and
not by their absolute position in the container.</li>
<li><strong>Ordered</strong> - The elements in the container follow a strict order at all times.
All inserted elements are given a position in this order.</li>
<li><strong>Set</strong> - The value of an element is also the key used to identify it.</li>
<li><strong>Unique keys</strong> - No two elements in the container can have equivalent keys.</li>
</ul>
</div>
  

  

  <div data-ice="exampleDocs">
    <h4>Example:</h4>
    
  <div class="example-doc" data-ice="exampleDoc">
      
      <pre class="prettyprint source-code"><code data-ice="exampleCode">let set = new TreeSet();
// add few values
set.add(1);
set.add(2);
// check whether key exists
let flag = set.has(1); // &lt;&lt; true
// print all keys
for (let key of set) {
  console.log(`key: ${key}`);
}</code></pre>
    </div>
</div>

  

  
</div>

<div data-ice="staticMemberSummary"><h2>Static Member Summary</h2><table class="summary" data-ice="summary">
  <thead><tr><td data-ice="title" colspan="3">Static Public Members</td></tr></thead>
  <tbody>
  
  <tr data-ice="target">
    <td>
      <span class="access" data-ice="access">public</span>
      <span data-ice="static">static</span>
      <span class="kind" data-ice="kind">get</span>
      
      <span class="override" data-ice="override"></span>
    </td>
    <td>
      <div>
        <p>
          
          
          
          <span class="code" data-ice="name"><span><a href="class/src/public/tree-set.js~TreeSet.html#static-get-[Symbol.species]">[Symbol.species]</a></span></span><span class="code" data-ice="signature">: <span>*</span>: <span>*</span></span>
        </p>
      </div>
      <div>
        
        
        <div data-ice="description"><p>Allows to create programmatically an instance of the same class</p>
</div>
      </div>
    </td>
    <td>
      
      
    </td>
  </tr>
</tbody>
</table>
</div>

<div data-ice="constructorSummary"><h2>Constructor Summary</h2><table class="summary" data-ice="summary">
  <thead><tr><td data-ice="title" colspan="3">Public Constructor</td></tr></thead>
  <tbody>
  
  <tr data-ice="target">
    <td>
      <span class="access" data-ice="access">public</span>
      
      
      
      <span class="override" data-ice="override"></span>
    </td>
    <td>
      <div>
        <p>
          
          
          
          <span class="code" data-ice="name"><span><a href="class/src/public/tree-set.js~TreeSet.html#instance-constructor-constructor">constructor</a></span></span><span class="code" data-ice="signature">(iterable: <span>*</span>)</span>
        </p>
      </div>
      <div>
        
        
        <div data-ice="description"><p>Creates an empty, or a pre-initialized set.</p>
</div>
      </div>
    </td>
    <td>
      
      
    </td>
  </tr>
</tbody>
</table>
</div>
<div data-ice="memberSummary"><h2>Member Summary</h2><table class="summary" data-ice="summary">
  <thead><tr><td data-ice="title" colspan="3">Public Members</td></tr></thead>
  <tbody>
  
  <tr data-ice="target">
    <td>
      <span class="access" data-ice="access">public</span>
      
      <span class="kind" data-ice="kind">get</span>
      
      <span class="override" data-ice="override"></span>
    </td>
    <td>
      <div>
        <p>
          
          
          
          <span class="code" data-ice="name"><span><a href="class/src/public/tree-set.js~TreeSet.html#instance-get-[Symbol.toStringTag]">[Symbol.toStringTag]</a></span></span><span class="code" data-ice="signature">: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a></span>: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></span></span>
        </p>
      </div>
      <div>
        
        
        <div data-ice="description"><p>String tag of this class</p>
</div>
      </div>
    </td>
    <td>
      
      
    </td>
  </tr>
<tr data-ice="target">
    <td>
      <span class="access" data-ice="access">public</span>
      
      <span class="kind" data-ice="kind">set</span>
      
      <span class="override" data-ice="override"></span>
    </td>
    <td>
      <div>
        <p>
          
          
          
          <span class="code" data-ice="name"><span><a href="class/src/public/tree-set.js~TreeSet.html#instance-set-compareFunc">compareFunc</a></span></span>
        </p>
      </div>
      <div>
        
        
        <div data-ice="description"><p>Sets custom comparison function if key values are not of primitive types.</p>
</div>
      </div>
    </td>
    <td>
      
      
    </td>
  </tr>
<tr data-ice="target">
    <td>
      <span class="access" data-ice="access">public</span>
      
      <span class="kind" data-ice="kind">get</span>
      
      <span class="override" data-ice="override"></span>
    </td>
    <td>
      <div>
        <p>
          
          
          
          <span class="code" data-ice="name"><span><a href="class/src/public/tree-set.js~TreeSet.html#instance-get-size">size</a></span></span><span class="code" data-ice="signature">: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a></span>: <span>*</span></span>
        </p>
      </div>
      <div>
        
        
        <div data-ice="description"><p>Number of keys in the set.</p>
</div>
      </div>
    </td>
    <td>
      
      
    </td>
  </tr>
</tbody>
</table>
</div>
<div data-ice="methodSummary"><h2>Method Summary</h2><table class="summary" data-ice="summary">
  <thead><tr><td data-ice="title" colspan="3">Public Methods</td></tr></thead>
  <tbody>
  
  <tr data-ice="target">
    <td>
      <span class="access" data-ice="access">public</span>
      
      
      
      <span class="override" data-ice="override"></span>
    </td>
    <td>
      <div>
        <p>
          
          
          
          <span class="code" data-ice="name"><span><a href="class/src/public/tree-set.js~TreeSet.html#instance-method-[Symbol.iterator]">[Symbol.iterator]</a></span></span><span class="code" data-ice="signature">(): <span><a href="class/src/public/js-iterators.js~JsIterator.html">JsIterator</a></span></span>
        </p>
      </div>
      <div>
        
        
        <div data-ice="description"><p>Forward ES6 iterator for all keys in ascending order.</p>
</div>
      </div>
    </td>
    <td>
      
      
    </td>
  </tr>
<tr data-ice="target">
    <td>
      <span class="access" data-ice="access">public</span>
      
      
      
      <span class="override" data-ice="override"></span>
    </td>
    <td>
      <div>
        <p>
          
          
          
          <span class="code" data-ice="name"><span><a href="class/src/public/tree-set.js~TreeSet.html#instance-method-add">add</a></span></span><span class="code" data-ice="signature">(key: <span>*</span>)</span>
        </p>
      </div>
      <div>
        
        
        <div data-ice="description"><p>Adds a key to the set, unless the key already exists.</p>
</div>
      </div>
    </td>
    <td>
      
      
    </td>
  </tr>
<tr data-ice="target">
    <td>
      <span class="access" data-ice="access">public</span>
      
      
      
      <span class="override" data-ice="override"></span>
    </td>
    <td>
      <div>
        <p>
          
          
          
          <span class="code" data-ice="name"><span><a href="class/src/public/tree-set.js~TreeSet.html#instance-method-backward">backward</a></span></span><span class="code" data-ice="signature">(): <span><a href="class/src/public/js-iterators.js~JsReverseIterator.html">JsReverseIterator</a></span></span>
        </p>
      </div>
      <div>
        
        
        <div data-ice="description"><p>ES6 reverse iterator for all keys in descending order.</p>
</div>
      </div>
    </td>
    <td>
      
      
    </td>
  </tr>
<tr data-ice="target">
    <td>
      <span class="access" data-ice="access">public</span>
      
      
      
      <span class="override" data-ice="override"></span>
    </td>
    <td>
      <div>
        <p>
          
          
          
          <span class="code" data-ice="name"><span><a href="class/src/public/tree-set.js~TreeSet.html#instance-method-begin">begin</a></span></span><span class="code" data-ice="signature">(): <span><a href="class/src/public/iterators.js~Iterator.html">Iterator</a></span></span>
        </p>
      </div>
      <div>
        
        
        <div data-ice="description"><p>Forward iterator to the first element</p>
</div>
      </div>
    </td>
    <td>
      
      
    </td>
  </tr>
<tr data-ice="target">
    <td>
      <span class="access" data-ice="access">public</span>
      
      
      
      <span class="override" data-ice="override"></span>
    </td>
    <td>
      <div>
        <p>
          
          
          
          <span class="code" data-ice="name"><span><a href="class/src/public/tree-set.js~TreeSet.html#instance-method-clear">clear</a></span></span><span class="code" data-ice="signature">()</span>
        </p>
      </div>
      <div>
        
        
        <div data-ice="description"><p>Removes all key-value pairs.</p>
</div>
      </div>
    </td>
    <td>
      
      
    </td>
  </tr>
<tr data-ice="target">
    <td>
      <span class="access" data-ice="access">public</span>
      
      
      
      <span class="override" data-ice="override"></span>
    </td>
    <td>
      <div>
        <p>
          
          
          
          <span class="code" data-ice="name"><span><a href="class/src/public/tree-set.js~TreeSet.html#instance-method-delete">delete</a></span></span><span class="code" data-ice="signature">(key: <span>*</span>)</span>
        </p>
      </div>
      <div>
        
        
        <div data-ice="description"><p>Removes key-value pair with the specified key if such entry exists.</p>
</div>
      </div>
    </td>
    <td>
      
      
    </td>
  </tr>
<tr data-ice="target">
    <td>
      <span class="access" data-ice="access">public</span>
      
      
      
      <span class="override" data-ice="override"></span>
    </td>
    <td>
      <div>
        <p>
          
          
          
          <span class="code" data-ice="name"><span><a href="class/src/public/tree-set.js~TreeSet.html#instance-method-end">end</a></span></span><span class="code" data-ice="signature">(): <span><a href="class/src/public/iterators.js~Iterator.html">Iterator</a></span></span>
        </p>
      </div>
      <div>
        
        
        <div data-ice="description"><p>Forward iterator to the element following the last element</p>
</div>
      </div>
    </td>
    <td>
      
      
    </td>
  </tr>
<tr data-ice="target">
    <td>
      <span class="access" data-ice="access">public</span>
      
      
      
      <span class="override" data-ice="override"></span>
    </td>
    <td>
      <div>
        <p>
          
          
          
          <span class="code" data-ice="name"><span><a href="class/src/public/tree-set.js~TreeSet.html#instance-method-entries">entries</a></span></span><span class="code" data-ice="signature">(): <span><a href="class/src/public/js-iterators.js~JsIterator.html">JsIterator</a></span></span>
        </p>
      </div>
      <div>
        
        
        <div data-ice="description"><p>Forward ES6 iterator for all values in ascending order.</p>
</div>
      </div>
    </td>
    <td>
      
      
    </td>
  </tr>
<tr data-ice="target">
    <td>
      <span class="access" data-ice="access">public</span>
      
      
      
      <span class="override" data-ice="override"></span>
    </td>
    <td>
      <div>
        <p>
          
          
          
          <span class="code" data-ice="name"><span><a href="class/src/public/tree-set.js~TreeSet.html#instance-method-erase">erase</a></span></span><span class="code" data-ice="signature">(iterator: <span><a href="class/src/public/iterators.js~Iterator.html">Iterator</a></span>)</span>
        </p>
      </div>
      <div>
        
        
        <div data-ice="description"><p>Removes value for the specified iterator.</p>
</div>
      </div>
    </td>
    <td>
      
      
    </td>
  </tr>
<tr data-ice="target">
    <td>
      <span class="access" data-ice="access">public</span>
      
      
      
      <span class="override" data-ice="override"></span>
    </td>
    <td>
      <div>
        <p>
          
          
          
          <span class="code" data-ice="name"><span><a href="class/src/public/tree-set.js~TreeSet.html#instance-method-find">find</a></span></span><span class="code" data-ice="signature">(key: <span>*</span>): <span><a href="class/src/public/iterators.js~Iterator.html">Iterator</a></span></span>
        </p>
      </div>
      <div>
        
        
        <div data-ice="description"><p>Finds an element with key equivalent to the specified one.</p>
</div>
      </div>
    </td>
    <td>
      
      
    </td>
  </tr>
<tr data-ice="target">
    <td>
      <span class="access" data-ice="access">public</span>
      
      
      
      <span class="override" data-ice="override"></span>
    </td>
    <td>
      <div>
        <p>
          
          
          
          <span class="code" data-ice="name"><span><a href="class/src/public/tree-set.js~TreeSet.html#instance-method-first">first</a></span></span><span class="code" data-ice="signature">(): <span>*</span></span>
        </p>
      </div>
      <div>
        
        
        
      </div>
    </td>
    <td>
      
      
    </td>
  </tr>
<tr data-ice="target">
    <td>
      <span class="access" data-ice="access">public</span>
      
      
      
      <span class="override" data-ice="override"></span>
    </td>
    <td>
      <div>
        <p>
          
          
          
          <span class="code" data-ice="name"><span><a href="class/src/public/tree-set.js~TreeSet.html#instance-method-forEach">forEach</a></span></span><span class="code" data-ice="signature">(callback: <span>*</span>)</span>
        </p>
      </div>
      <div>
        
        
        <div data-ice="description"><p>Iterates all values using a callback in ascending order.</p>
</div>
      </div>
    </td>
    <td>
      
      
    </td>
  </tr>
<tr data-ice="target">
    <td>
      <span class="access" data-ice="access">public</span>
      
      
      
      <span class="override" data-ice="override"></span>
    </td>
    <td>
      <div>
        <p>
          
          
          
          <span class="code" data-ice="name"><span><a href="class/src/public/tree-set.js~TreeSet.html#instance-method-has">has</a></span></span><span class="code" data-ice="signature">(key: <span>*</span>): <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">Boolean</a></span></span>
        </p>
      </div>
      <div>
        
        
        <div data-ice="description"><p>A boolean indicator whether set contains the specified key.</p>
</div>
      </div>
    </td>
    <td>
      
      
    </td>
  </tr>
<tr data-ice="target">
    <td>
      <span class="access" data-ice="access">public</span>
      
      
      
      <span class="override" data-ice="override"></span>
    </td>
    <td>
      <div>
        <p>
          
          
          
          <span class="code" data-ice="name"><span><a href="class/src/public/tree-set.js~TreeSet.html#instance-method-insertOrReplace">insertOrReplace</a></span></span><span class="code" data-ice="signature">(key: <span>*</span>): <span><a href="class/src/public/insertion-result.js~InsertionResult.html">InsertionResult</a></span></span>
        </p>
      </div>
      <div>
        
        
        <div data-ice="description"><p>Adds key-value pair if such key does not exist in the map.</p>
</div>
      </div>
    </td>
    <td>
      
      
    </td>
  </tr>
<tr data-ice="target">
    <td>
      <span class="access" data-ice="access">public</span>
      
      
      
      <span class="override" data-ice="override"></span>
    </td>
    <td>
      <div>
        <p>
          
          
          
          <span class="code" data-ice="name"><span><a href="class/src/public/tree-set.js~TreeSet.html#instance-method-insertUnique">insertUnique</a></span></span><span class="code" data-ice="signature">(key: <span>*</span>): <span><a href="class/src/public/insertion-result.js~InsertionResult.html">InsertionResult</a></span></span>
        </p>
      </div>
      <div>
        
        
        <div data-ice="description"><p>Adds a key if it doesn&apos;t exist</p>
</div>
      </div>
    </td>
    <td>
      
      
    </td>
  </tr>
<tr data-ice="target">
    <td>
      <span class="access" data-ice="access">public</span>
      
      
      
      <span class="override" data-ice="override"></span>
    </td>
    <td>
      <div>
        <p>
          
          
          
          <span class="code" data-ice="name"><span><a href="class/src/public/tree-set.js~TreeSet.html#instance-method-keys">keys</a></span></span><span class="code" data-ice="signature">(): <span><a href="class/src/public/js-iterators.js~JsIterator.html">JsIterator</a></span></span>
        </p>
      </div>
      <div>
        
        
        <div data-ice="description"><p>Forward ES6 iterator for all keys in ascending order.</p>
</div>
      </div>
    </td>
    <td>
      
      
    </td>
  </tr>
<tr data-ice="target">
    <td>
      <span class="access" data-ice="access">public</span>
      
      
      
      <span class="override" data-ice="override"></span>
    </td>
    <td>
      <div>
        <p>
          
          
          
          <span class="code" data-ice="name"><span><a href="class/src/public/tree-set.js~TreeSet.html#instance-method-last">last</a></span></span><span class="code" data-ice="signature">(): <span>*</span></span>
        </p>
      </div>
      <div>
        
        
        
      </div>
    </td>
    <td>
      
      
    </td>
  </tr>
<tr data-ice="target">
    <td>
      <span class="access" data-ice="access">public</span>
      
      
      
      <span class="override" data-ice="override"></span>
    </td>
    <td>
      <div>
        <p>
          
          
          
          <span class="code" data-ice="name"><span><a href="class/src/public/tree-set.js~TreeSet.html#instance-method-lowerBound">lowerBound</a></span></span><span class="code" data-ice="signature">(key: <span>*</span>): <span><a href="class/src/public/iterators.js~Iterator.html">Iterator</a></span></span>
        </p>
      </div>
      <div>
        
        
        <div data-ice="description"><p>Iterator pointing to the first element that is not less than specified key.</p>
</div>
      </div>
    </td>
    <td>
      
      
    </td>
  </tr>
<tr data-ice="target">
    <td>
      <span class="access" data-ice="access">public</span>
      
      
      
      <span class="override" data-ice="override"></span>
    </td>
    <td>
      <div>
        <p>
          
          
          
          <span class="code" data-ice="name"><span><a href="class/src/public/tree-set.js~TreeSet.html#instance-method-rbegin">rbegin</a></span></span><span class="code" data-ice="signature">(): <span><a href="class/src/public/iterators.js~ReverseIterator.html">ReverseIterator</a></span></span>
        </p>
      </div>
      <div>
        
        
        <div data-ice="description"><p>Reverse iterator to the last element.</p>
</div>
      </div>
    </td>
    <td>
      
      
    </td>
  </tr>
<tr data-ice="target">
    <td>
      <span class="access" data-ice="access">public</span>
      
      
      
      <span class="override" data-ice="override"></span>
    </td>
    <td>
      <div>
        <p>
          
          
          
          <span class="code" data-ice="name"><span><a href="class/src/public/tree-set.js~TreeSet.html#instance-method-rend">rend</a></span></span><span class="code" data-ice="signature">(): <span><a href="class/src/public/iterators.js~ReverseIterator.html">ReverseIterator</a></span></span>
        </p>
      </div>
      <div>
        
        
        <div data-ice="description"><p>Reverse iterator pointing to before the first element.</p>
</div>
      </div>
    </td>
    <td>
      
      
    </td>
  </tr>
<tr data-ice="target">
    <td>
      <span class="access" data-ice="access">public</span>
      
      
      
      <span class="override" data-ice="override"></span>
    </td>
    <td>
      <div>
        <p>
          
          
          
          <span class="code" data-ice="name"><span><a href="class/src/public/tree-set.js~TreeSet.html#instance-method-toString">toString</a></span></span><span class="code" data-ice="signature">(): <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a></span></span>
        </p>
      </div>
      <div>
        
        
        <div data-ice="description"><p>Serializes contents of the set in the form {key1,key2,...}</p>
</div>
      </div>
    </td>
    <td>
      
      
    </td>
  </tr>
<tr data-ice="target">
    <td>
      <span class="access" data-ice="access">public</span>
      
      
      
      <span class="override" data-ice="override"></span>
    </td>
    <td>
      <div>
        <p>
          
          
          
          <span class="code" data-ice="name"><span><a href="class/src/public/tree-set.js~TreeSet.html#instance-method-upperBound">upperBound</a></span></span><span class="code" data-ice="signature">(key: <span>*</span>): <span><a href="class/src/public/iterators.js~Iterator.html">Iterator</a></span></span>
        </p>
      </div>
      <div>
        
        
        <div data-ice="description"><p>Iterator pointing to the first element that is greater than key.</p>
</div>
      </div>
    </td>
    <td>
      
      
    </td>
  </tr>
<tr data-ice="target">
    <td>
      <span class="access" data-ice="access">public</span>
      
      
      
      <span class="override" data-ice="override"></span>
    </td>
    <td>
      <div>
        <p>
          
          
          
          <span class="code" data-ice="name"><span><a href="class/src/public/tree-set.js~TreeSet.html#instance-method-values">values</a></span></span><span class="code" data-ice="signature">(): <span>JsITerator</span></span>
        </p>
      </div>
      <div>
        
        
        <div data-ice="description"><p>Forward ES6 iterator for all keys in ascending order.</p>
</div>
      </div>
    </td>
    <td>
      
      
    </td>
  </tr>
</tbody>
</table>
</div>



<div data-ice="staticMemberDetails"><h2 data-ice="title">Static Public Members</h2>

<div class="detail" data-ice="detail">
  <h3 data-ice="anchor" id="static-get-[Symbol.species]">
    <span class="access" data-ice="access">public</span>
    <span data-ice="static">static</span>
    <span class="kind" data-ice="kind">get</span>
    
    
    
    <span class="code" data-ice="name">[Symbol.species]</span><span class="code" data-ice="signature">: <span>*</span>: <span>*</span></span>
    <span class="right-info">
      
      
      <span data-ice="source"><span><a href="file/src/public/tree-set.js.html#lineNumber87">source</a></span></span>
    </span>
  </h3>

  
  
  
  <div data-ice="description"><p>Allows to create programmatically an instance of the same class</p>
</div>

  

  <div data-ice="properties">
</div>

  <div class="return-params" data-ice="returnParams">
    <h4>Return:</h4>
    <table>
      <tbody>
        <tr>
          <td class="return-type code" data-ice="returnType"><span>*</span></td>
          <td class="return-desc" data-ice="returnDescription"><p>constructor object for this class.</p>
</td>
        </tr>
      </tbody>
    </table>
    <div data-ice="returnProperties">
</div>
  </div>

  

  

  

  

  <div data-ice="example">
    <h4>Example:</h4>
    
  <div class="example-doc" data-ice="exampleDoc">
      
      <pre class="prettyprint source-code"><code data-ice="exampleCode">let set = new TreeSet();
let constrFunc = Object.getPrototypeOf(set).constructor[Symbol.species];
let set2 = new constrFunc();</code></pre>
    </div>
</div>

  

  
  
</div>
</div>

<div data-ice="constructorDetails"><h2 data-ice="title">Public Constructors</h2>

<div class="detail" data-ice="detail">
  <h3 data-ice="anchor" id="instance-constructor-constructor">
    <span class="access" data-ice="access">public</span>
    
    
    
    
    
    <span class="code" data-ice="name">constructor</span><span class="code" data-ice="signature">(iterable: <span>*</span>)</span>
    <span class="right-info">
      
      
      <span data-ice="source"><span><a href="file/src/public/tree-set.js.html#lineNumber51">source</a></span></span>
    </span>
  </h3>

  
  
  
  <div data-ice="description"><p>Creates an empty, or a pre-initialized set.</p>
</div>

  

  <div data-ice="properties"><div data-ice="properties">
  <h4 data-ice="title">Params:</h4>
  <table class="params">
    <thead>
    <tr><td>Name</td><td>Type</td><td>Attribute</td><td>Description</td></tr>
    </thead>
    <tbody>
    
    <tr data-ice="property" data-depth="0">
      <td data-ice="name" class="code" data-depth="0">iterable</td>
      <td data-ice="type" class="code"><span>*</span></td>
      <td data-ice="appendix"><ul><li>optional</li></ul></td>
      <td data-ice="description"><p>Another iterable object whose values are added into the newly created set.</p>
</td>
    </tr>
</tbody>
  </table>
</div>
</div>

  

  

  

  

  

  <div data-ice="example">
    <h4>Example:</h4>
    
  <div class="example-doc" data-ice="exampleDoc">
      
      <pre class="prettyprint source-code"><code data-ice="exampleCode">// Create an empty set
let set = new TreeSet();
// Create and initialize set
let set2 = new TreeSet([1, 2, 3]);</code></pre>
    </div>
</div>

  

  
  
</div>
</div>
<div data-ice="memberDetails"><h2 data-ice="title">Public Members</h2>

<div class="detail" data-ice="detail">
  <h3 data-ice="anchor" id="instance-get-[Symbol.toStringTag]">
    <span class="access" data-ice="access">public</span>
    
    <span class="kind" data-ice="kind">get</span>
    
    
    
    <span class="code" data-ice="name">[Symbol.toStringTag]</span><span class="code" data-ice="signature">: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a></span>: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></span></span>
    <span class="right-info">
      
      
      <span data-ice="source"><span><a href="file/src/public/tree-set.js.html#lineNumber75">source</a></span></span>
    </span>
  </h3>

  
  
  
  <div data-ice="description"><p>String tag of this class</p>
</div>

  

  <div data-ice="properties">
</div>

  <div class="return-params" data-ice="returnParams">
    <h4>Return:</h4>
    <table>
      <tbody>
        <tr>
          <td class="return-type code" data-ice="returnType"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a></span></td>
          
        </tr>
      </tbody>
    </table>
    <div data-ice="returnProperties">
</div>
  </div>

  

  

  

  

  <div data-ice="example">
    <h4>Example:</h4>
    
  <div class="example-doc" data-ice="exampleDoc">
      
      <pre class="prettyprint source-code"><code data-ice="exampleCode">Object.prototype.toString.call(new TreeSet()); // &quot;[object TreeSet]&quot;</code></pre>
    </div>
</div>

  

  
  
</div>
<div class="detail" data-ice="detail">
  <h3 data-ice="anchor" id="instance-set-compareFunc">
    <span class="access" data-ice="access">public</span>
    
    <span class="kind" data-ice="kind">set</span>
    
    
    
    <span class="code" data-ice="name">compareFunc</span>
    <span class="right-info">
      
      
      <span data-ice="source"><span><a href="file/src/public/tree-set.js.html#lineNumber259">source</a></span></span>
    </span>
  </h3>

  
  
  
  <div data-ice="description"><p>Sets custom comparison function if key values are not of primitive types.
Callback is a 3-way comparison function accepts two key values (lhs, rhs). It is expected to return
     +1 if the value of rhs is greater than lhs
     -1 if the value of rhs is less than lhs
      0 if values are the same</p>
</div>

  

  <div data-ice="properties">
</div>

  

  

  

  

  

  

  

  
  
</div>
<div class="detail" data-ice="detail">
  <h3 data-ice="anchor" id="instance-get-size">
    <span class="access" data-ice="access">public</span>
    
    <span class="kind" data-ice="kind">get</span>
    
    
    
    <span class="code" data-ice="name">size</span><span class="code" data-ice="signature">: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a></span>: <span>*</span></span>
    <span class="right-info">
      
      
      <span data-ice="source"><span><a href="file/src/public/tree-set.js.html#lineNumber200">source</a></span></span>
    </span>
  </h3>

  
  
  
  <div data-ice="description"><p>Number of keys in the set.</p>
</div>

  

  <div data-ice="properties">
</div>

  <div class="return-params" data-ice="returnParams">
    <h4>Return:</h4>
    <table>
      <tbody>
        <tr>
          <td class="return-type code" data-ice="returnType"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">Number</a></span></td>
          
        </tr>
      </tbody>
    </table>
    <div data-ice="returnProperties">
</div>
  </div>

  

  

  

  

  

  

  
  
</div>
</div>
<div data-ice="methodDetails"><h2 data-ice="title">Public Methods</h2>

<div class="detail" data-ice="detail">
  <h3 data-ice="anchor" id="instance-method-[Symbol.iterator]">
    <span class="access" data-ice="access">public</span>
    
    
    
    
    
    <span class="code" data-ice="name">[Symbol.iterator]</span><span class="code" data-ice="signature">(): <span><a href="class/src/public/js-iterators.js~JsIterator.html">JsIterator</a></span></span>
    <span class="right-info">
      
      
      <span data-ice="source"><span><a href="file/src/public/tree-set.js.html#lineNumber232">source</a></span></span>
    </span>
  </h3>

  
  
  
  <div data-ice="description"><p>Forward ES6 iterator for all keys in ascending order. The same as entries() method</p>
</div>

  

  <div data-ice="properties">
</div>

  <div class="return-params" data-ice="returnParams">
    <h4>Return:</h4>
    <table>
      <tbody>
        <tr>
          <td class="return-type code" data-ice="returnType"><span><a href="class/src/public/js-iterators.js~JsIterator.html">JsIterator</a></span></td>
          
        </tr>
      </tbody>
    </table>
    <div data-ice="returnProperties">
</div>
  </div>

  

  

  

  

  <div data-ice="example">
    <h4>Example:</h4>
    
  <div class="example-doc" data-ice="exampleDoc">
      
      <pre class="prettyprint source-code"><code data-ice="exampleCode">let set = new TreeSet([1, 2, 3]);
for (let key of set) {
  console.log(`key: ${key}, value: ${value}`);
}</code></pre>
    </div>
</div>

  

  
  
</div>
<div class="detail" data-ice="detail">
  <h3 data-ice="anchor" id="instance-method-add">
    <span class="access" data-ice="access">public</span>
    
    
    
    
    
    <span class="code" data-ice="name">add</span><span class="code" data-ice="signature">(key: <span>*</span>)</span>
    <span class="right-info">
      
      
      <span data-ice="source"><span><a href="file/src/public/tree-set.js.html#lineNumber190">source</a></span></span>
    </span>
  </h3>

  
  
  
  <div data-ice="description"><p>Adds a key to the set, unless the key already exists.</p>
</div>

  

  <div data-ice="properties"><div data-ice="properties">
  <h4 data-ice="title">Params:</h4>
  <table class="params">
    <thead>
    <tr><td>Name</td><td>Type</td><td>Attribute</td><td>Description</td></tr>
    </thead>
    <tbody>
    
    <tr data-ice="property" data-depth="0">
      <td data-ice="name" class="code" data-depth="0">key</td>
      <td data-ice="type" class="code"><span>*</span></td>
      <td data-ice="appendix"></td>
      <td data-ice="description"></td>
    </tr>
</tbody>
  </table>
</div>
</div>

  

  

  

  

  

  <div data-ice="example">
    <h4>Example:</h4>
    
  <div class="example-doc" data-ice="exampleDoc">
      
      <pre class="prettyprint source-code"><code data-ice="exampleCode">let set = new TreeSet();
set.add(1);</code></pre>
    </div>
</div>

  

  
  
</div>
<div class="detail" data-ice="detail">
  <h3 data-ice="anchor" id="instance-method-backward">
    <span class="access" data-ice="access">public</span>
    
    
    
    
    
    <span class="code" data-ice="name">backward</span><span class="code" data-ice="signature">(): <span><a href="class/src/public/js-iterators.js~JsReverseIterator.html">JsReverseIterator</a></span></span>
    <span class="right-info">
      
      
      <span data-ice="source"><span><a href="file/src/public/tree-set.js.html#lineNumber248">source</a></span></span>
    </span>
  </h3>

  
  
  
  <div data-ice="description"><p>ES6 reverse iterator for all keys in descending order.</p>
</div>

  

  <div data-ice="properties">
</div>

  <div class="return-params" data-ice="returnParams">
    <h4>Return:</h4>
    <table>
      <tbody>
        <tr>
          <td class="return-type code" data-ice="returnType"><span><a href="class/src/public/js-iterators.js~JsReverseIterator.html">JsReverseIterator</a></span></td>
          
        </tr>
      </tbody>
    </table>
    <div data-ice="returnProperties">
</div>
  </div>

  

  

  

  

  <div data-ice="example">
    <h4>Example:</h4>
    
  <div class="example-doc" data-ice="exampleDoc">
      
      <pre class="prettyprint source-code"><code data-ice="exampleCode">let set = new TreeSet([1, 2, 3]);
for (let key of set.backwards()) {
  console.log(`key: ${key}`);
}</code></pre>
    </div>
</div>

  

  
  
</div>
<div class="detail" data-ice="detail">
  <h3 data-ice="anchor" id="instance-method-begin">
    <span class="access" data-ice="access">public</span>
    
    
    
    
    
    <span class="code" data-ice="name">begin</span><span class="code" data-ice="signature">(): <span><a href="class/src/public/iterators.js~Iterator.html">Iterator</a></span></span>
    <span class="right-info">
      
      
      <span data-ice="source"><span><a href="file/src/public/tree-set.js.html#lineNumber278">source</a></span></span>
    </span>
  </h3>

  
  
  
  <div data-ice="description"><p>Forward iterator to the first element</p>
</div>

  

  <div data-ice="properties">
</div>

  <div class="return-params" data-ice="returnParams">
    <h4>Return:</h4>
    <table>
      <tbody>
        <tr>
          <td class="return-type code" data-ice="returnType"><span><a href="class/src/public/iterators.js~Iterator.html">Iterator</a></span></td>
          
        </tr>
      </tbody>
    </table>
    <div data-ice="returnProperties">
</div>
  </div>

  

  

  

  

  <div data-ice="example">
    <h4>Example:</h4>
    
  <div class="example-doc" data-ice="exampleDoc">
      
      <pre class="prettyprint source-code"><code data-ice="exampleCode">let set = new TreeSet();
...
for (let it = set.begin(); !it.equals(set.end()); it.next()) {
  console.log(`key: ${it.key}`);
}</code></pre>
    </div>
</div>

  

  
  
</div>
<div class="detail" data-ice="detail">
  <h3 data-ice="anchor" id="instance-method-clear">
    <span class="access" data-ice="access">public</span>
    
    
    
    
    
    <span class="code" data-ice="name">clear</span><span class="code" data-ice="signature">()</span>
    <span class="right-info">
      
      
      <span data-ice="source"><span><a href="file/src/public/tree-set.js.html#lineNumber98">source</a></span></span>
    </span>
  </h3>

  
  
  
  <div data-ice="description"><p>Removes all key-value pairs.</p>
</div>

  

  <div data-ice="properties">
</div>

  

  

  

  

  

  <div data-ice="example">
    <h4>Example:</h4>
    
  <div class="example-doc" data-ice="exampleDoc">
      
      <pre class="prettyprint source-code"><code data-ice="exampleCode">let set = new TreeSet([1, 2, 3]);
set.clear();
console.log(set.size); // 0</code></pre>
    </div>
</div>

  

  
  
</div>
<div class="detail" data-ice="detail">
  <h3 data-ice="anchor" id="instance-method-delete">
    <span class="access" data-ice="access">public</span>
    
    
    
    
    
    <span class="code" data-ice="name">delete</span><span class="code" data-ice="signature">(key: <span>*</span>)</span>
    <span class="right-info">
      
      
      <span data-ice="source"><span><a href="file/src/public/tree-set.js.html#lineNumber109">source</a></span></span>
    </span>
  </h3>

  
  
  
  <div data-ice="description"><p>Removes key-value pair with the specified key if such entry exists. Does nothing otherwise.</p>
</div>

  

  <div data-ice="properties"><div data-ice="properties">
  <h4 data-ice="title">Params:</h4>
  <table class="params">
    <thead>
    <tr><td>Name</td><td>Type</td><td>Attribute</td><td>Description</td></tr>
    </thead>
    <tbody>
    
    <tr data-ice="property" data-depth="0">
      <td data-ice="name" class="code" data-depth="0">key</td>
      <td data-ice="type" class="code"><span>*</span></td>
      <td data-ice="appendix"></td>
      <td data-ice="description"></td>
    </tr>
</tbody>
  </table>
</div>
</div>

  

  

  

  

  

  <div data-ice="example">
    <h4>Example:</h4>
    
  <div class="example-doc" data-ice="exampleDoc">
      
      <pre class="prettyprint source-code"><code data-ice="exampleCode">let set = new TreeSet([1, 2, 3]);
set.delete(2);
console.log(set.toString()); // {1,3}</code></pre>
    </div>
</div>

  

  
  
</div>
<div class="detail" data-ice="detail">
  <h3 data-ice="anchor" id="instance-method-end">
    <span class="access" data-ice="access">public</span>
    
    
    
    
    
    <span class="code" data-ice="name">end</span><span class="code" data-ice="signature">(): <span><a href="class/src/public/iterators.js~Iterator.html">Iterator</a></span></span>
    <span class="right-info">
      
      
      <span data-ice="source"><span><a href="file/src/public/tree-set.js.html#lineNumber292">source</a></span></span>
    </span>
  </h3>

  
  
  
  <div data-ice="description"><p>Forward iterator to the element following the last element</p>
</div>

  

  <div data-ice="properties">
</div>

  <div class="return-params" data-ice="returnParams">
    <h4>Return:</h4>
    <table>
      <tbody>
        <tr>
          <td class="return-type code" data-ice="returnType"><span><a href="class/src/public/iterators.js~Iterator.html">Iterator</a></span></td>
          
        </tr>
      </tbody>
    </table>
    <div data-ice="returnProperties">
</div>
  </div>

  

  

  

  

  <div data-ice="example">
    <h4>Example:</h4>
    
  <div class="example-doc" data-ice="exampleDoc">
      
      <pre class="prettyprint source-code"><code data-ice="exampleCode">let set = new TreeSet();
...
for (let it = set.begin(); !it.equals(set.end()); it.next()) {
  console.log(`key: ${it.key}`);
}</code></pre>
    </div>
</div>

  

  
  
</div>
<div class="detail" data-ice="detail">
  <h3 data-ice="anchor" id="instance-method-entries">
    <span class="access" data-ice="access">public</span>
    
    
    
    
    
    <span class="code" data-ice="name">entries</span><span class="code" data-ice="signature">(): <span><a href="class/src/public/js-iterators.js~JsIterator.html">JsIterator</a></span></span>
    <span class="right-info">
      
      
      <span data-ice="source"><span><a href="file/src/public/tree-set.js.html#lineNumber125">source</a></span></span>
    </span>
  </h3>

  
  
  
  <div data-ice="description"><p>Forward ES6 iterator for all values in ascending order.</p>
</div>

  

  <div data-ice="properties">
</div>

  <div class="return-params" data-ice="returnParams">
    <h4>Return:</h4>
    <table>
      <tbody>
        <tr>
          <td class="return-type code" data-ice="returnType"><span><a href="class/src/public/js-iterators.js~JsIterator.html">JsIterator</a></span></td>
          
        </tr>
      </tbody>
    </table>
    <div data-ice="returnProperties">
</div>
  </div>

  

  

  

  

  <div data-ice="example">
    <h4>Example:</h4>
    
  <div class="example-doc" data-ice="exampleDoc">
      
      <pre class="prettyprint source-code"><code data-ice="exampleCode">let set = new TreeSet([1, 2, 3]);
for (let key of set.entries()) {
  console.log(`key: ${key}`);
}</code></pre>
    </div>
</div>

  

  
  
</div>
<div class="detail" data-ice="detail">
  <h3 data-ice="anchor" id="instance-method-erase">
    <span class="access" data-ice="access">public</span>
    
    
    
    
    
    <span class="code" data-ice="name">erase</span><span class="code" data-ice="signature">(iterator: <span><a href="class/src/public/iterators.js~Iterator.html">Iterator</a></span>)</span>
    <span class="right-info">
      
      
      <span data-ice="source"><span><a href="file/src/public/tree-set.js.html#lineNumber364">source</a></span></span>
    </span>
  </h3>

  
  
  
  <div data-ice="description"><p>Removes value for the specified iterator.</p>
</div>

  

  <div data-ice="properties"><div data-ice="properties">
  <h4 data-ice="title">Params:</h4>
  <table class="params">
    <thead>
    <tr><td>Name</td><td>Type</td><td>Attribute</td><td>Description</td></tr>
    </thead>
    <tbody>
    
    <tr data-ice="property" data-depth="0">
      <td data-ice="name" class="code" data-depth="0">iterator</td>
      <td data-ice="type" class="code"><span><a href="class/src/public/iterators.js~Iterator.html">Iterator</a></span></td>
      <td data-ice="appendix"></td>
      <td data-ice="description"></td>
    </tr>
</tbody>
  </table>
</div>
</div>

  

  

  

  

  

  <div data-ice="example">
    <h4>Example:</h4>
    
  <div class="example-doc" data-ice="exampleDoc">
      
      <pre class="prettyprint source-code"><code data-ice="exampleCode">let set = new TreeSet([1,2,3]);
let it = set.find(2);
it.prev();
set.erase(it); // removes a node with key 1
console.log(set.toString()); // {2,3}</code></pre>
    </div>
</div>

  

  
  
</div>
<div class="detail" data-ice="detail">
  <h3 data-ice="anchor" id="instance-method-find">
    <span class="access" data-ice="access">public</span>
    
    
    
    
    
    <span class="code" data-ice="name">find</span><span class="code" data-ice="signature">(key: <span>*</span>): <span><a href="class/src/public/iterators.js~Iterator.html">Iterator</a></span></span>
    <span class="right-info">
      
      
      <span data-ice="source"><span><a href="file/src/public/tree-set.js.html#lineNumber308">source</a></span></span>
    </span>
  </h3>

  
  
  
  <div data-ice="description"><p>Finds an element with key equivalent to the specified one. If such key does not exist end() iterator is returned.</p>
</div>

  

  <div data-ice="properties"><div data-ice="properties">
  <h4 data-ice="title">Params:</h4>
  <table class="params">
    <thead>
    <tr><td>Name</td><td>Type</td><td>Attribute</td><td>Description</td></tr>
    </thead>
    <tbody>
    
    <tr data-ice="property" data-depth="0">
      <td data-ice="name" class="code" data-depth="0">key</td>
      <td data-ice="type" class="code"><span>*</span></td>
      <td data-ice="appendix"></td>
      <td data-ice="description"></td>
    </tr>
</tbody>
  </table>
</div>
</div>

  <div class="return-params" data-ice="returnParams">
    <h4>Return:</h4>
    <table>
      <tbody>
        <tr>
          <td class="return-type code" data-ice="returnType"><span><a href="class/src/public/iterators.js~Iterator.html">Iterator</a></span></td>
          
        </tr>
      </tbody>
    </table>
    <div data-ice="returnProperties">
</div>
  </div>

  

  

  

  

  <div data-ice="example">
    <h4>Example:</h4>
    
  <div class="example-doc" data-ice="exampleDoc">
      
      <pre class="prettyprint source-code"><code data-ice="exampleCode">let set = new TreeSet([1, 2, 3]);
...
let it = set.find(1);
if (!it.equals(set.end())) {
  console.log(`Found key: ${it.key}`); // 1
}</code></pre>
    </div>
</div>

  

  
  
</div>
<div class="detail" data-ice="detail">
  <h3 data-ice="anchor" id="instance-method-first">
    <span class="access" data-ice="access">public</span>
    
    
    
    
    
    <span class="code" data-ice="name">first</span><span class="code" data-ice="signature">(): <span>*</span></span>
    <span class="right-info">
      
      
      <span data-ice="source"><span><a href="file/src/public/tree-set.js.html#lineNumber464">source</a></span></span>
    </span>
  </h3>

  
  
  
  

  

  <div data-ice="properties">
</div>

  <div class="return-params" data-ice="returnParams">
    <h4>Return:</h4>
    <table>
      <tbody>
        <tr>
          <td class="return-type code" data-ice="returnType"><span>*</span></td>
          <td class="return-desc" data-ice="returnDescription"><p>first element of the container, or undefined if container is empty</p>
</td>
        </tr>
      </tbody>
    </table>
    <div data-ice="returnProperties">
</div>
  </div>

  

  

  

  

  <div data-ice="example">
    <h4>Example:</h4>
    
  <div class="example-doc" data-ice="exampleDoc">
      
      <pre class="prettyprint source-code"><code data-ice="exampleCode">let set = new TreeSet([1, 2, 3]);
let first = set.first(); // 1</code></pre>
    </div>
</div>

  

  
  
</div>
<div class="detail" data-ice="detail">
  <h3 data-ice="anchor" id="instance-method-forEach">
    <span class="access" data-ice="access">public</span>
    
    
    
    
    
    <span class="code" data-ice="name">forEach</span><span class="code" data-ice="signature">(callback: <span>*</span>)</span>
    <span class="right-info">
      
      
      <span data-ice="source"><span><a href="file/src/public/tree-set.js.html#lineNumber139">source</a></span></span>
    </span>
  </h3>

  
  
  
  <div data-ice="description"><p>Iterates all values using a callback in ascending order.
Note that ES6 specifies the order of key parameters in the callback differently from for-of loop.</p>
</div>

  

  <div data-ice="properties"><div data-ice="properties">
  <h4 data-ice="title">Params:</h4>
  <table class="params">
    <thead>
    <tr><td>Name</td><td>Type</td><td>Attribute</td><td>Description</td></tr>
    </thead>
    <tbody>
    
    <tr data-ice="property" data-depth="0">
      <td data-ice="name" class="code" data-depth="0">callback</td>
      <td data-ice="type" class="code"><span>*</span></td>
      <td data-ice="appendix"></td>
      <td data-ice="description"></td>
    </tr>
</tbody>
  </table>
</div>
</div>

  

  

  

  

  

  <div data-ice="example">
    <h4>Example:</h4>
    
  <div class="example-doc" data-ice="exampleDoc">
      
      <pre class="prettyprint source-code"><code data-ice="exampleCode">let set = new TreeSet([1, 2, 3]);
set.forEach(function(value, key, container) {
  // value is the same as key
  console.log(`key: ${key}, value: ${value}`);
});</code></pre>
    </div>
</div>

  

  
  
</div>
<div class="detail" data-ice="detail">
  <h3 data-ice="anchor" id="instance-method-has">
    <span class="access" data-ice="access">public</span>
    
    
    
    
    
    <span class="code" data-ice="name">has</span><span class="code" data-ice="signature">(key: <span>*</span>): <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">Boolean</a></span></span>
    <span class="right-info">
      
      
      <span data-ice="source"><span><a href="file/src/public/tree-set.js.html#lineNumber154">source</a></span></span>
    </span>
  </h3>

  
  
  
  <div data-ice="description"><p>A boolean indicator whether set contains the specified key.</p>
</div>

  

  <div data-ice="properties"><div data-ice="properties">
  <h4 data-ice="title">Params:</h4>
  <table class="params">
    <thead>
    <tr><td>Name</td><td>Type</td><td>Attribute</td><td>Description</td></tr>
    </thead>
    <tbody>
    
    <tr data-ice="property" data-depth="0">
      <td data-ice="name" class="code" data-depth="0">key</td>
      <td data-ice="type" class="code"><span>*</span></td>
      <td data-ice="appendix"></td>
      <td data-ice="description"><p>a value of any type that can be compared with a key</p>
</td>
    </tr>
</tbody>
  </table>
</div>
</div>

  <div class="return-params" data-ice="returnParams">
    <h4>Return:</h4>
    <table>
      <tbody>
        <tr>
          <td class="return-type code" data-ice="returnType"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">Boolean</a></span></td>
          
        </tr>
      </tbody>
    </table>
    <div data-ice="returnProperties">
</div>
  </div>

  

  

  

  

  <div data-ice="example">
    <h4>Example:</h4>
    
  <div class="example-doc" data-ice="exampleDoc">
      
      <pre class="prettyprint source-code"><code data-ice="exampleCode">let set = new TreeSet([1, 2, 3]);
let b = set.get(3); // true
b = set.get(4); // false</code></pre>
    </div>
</div>

  

  
  
</div>
<div class="detail" data-ice="detail">
  <h3 data-ice="anchor" id="instance-method-insertOrReplace">
    <span class="access" data-ice="access">public</span>
    
    
    
    
    
    <span class="code" data-ice="name">insertOrReplace</span><span class="code" data-ice="signature">(key: <span>*</span>): <span><a href="class/src/public/insertion-result.js~InsertionResult.html">InsertionResult</a></span></span>
    <span class="right-info">
      
      
      <span data-ice="source"><span><a href="file/src/public/tree-set.js.html#lineNumber348">source</a></span></span>
    </span>
  </h3>

  
  
  
  <div data-ice="description"><p>Adds key-value pair if such key does not exist in the map. Replaces value if such key exists</p>
</div>

  

  <div data-ice="properties"><div data-ice="properties">
  <h4 data-ice="title">Params:</h4>
  <table class="params">
    <thead>
    <tr><td>Name</td><td>Type</td><td>Attribute</td><td>Description</td></tr>
    </thead>
    <tbody>
    
    <tr data-ice="property" data-depth="0">
      <td data-ice="name" class="code" data-depth="0">key</td>
      <td data-ice="type" class="code"><span>*</span></td>
      <td data-ice="appendix"></td>
      <td data-ice="description"></td>
    </tr>
</tbody>
  </table>
</div>
</div>

  <div class="return-params" data-ice="returnParams">
    <h4>Return:</h4>
    <table>
      <tbody>
        <tr>
          <td class="return-type code" data-ice="returnType"><span><a href="class/src/public/insertion-result.js~InsertionResult.html">InsertionResult</a></span></td>
          <td class="return-desc" data-ice="returnDescription"><p>indicates whether a node was added and provides iterator to it.</p>
</td>
        </tr>
      </tbody>
    </table>
    <div data-ice="returnProperties">
</div>
  </div>

  

  

  

  

  <div data-ice="example">
    <h4>Example:</h4>
    
  <div class="example-doc" data-ice="exampleDoc">
      
      <pre class="prettyprint source-code"><code data-ice="exampleCode">let set = new TreeSet();
let res = set.insertOrReplace(1);
if (res.wasInserted) {
  console.log(`Inserted ${res.iterator.key}`); // prints 1
}
res = set.insertOrReplace(1) // returns iterator to the previously added node
if (res.wasInserted) {
  console.log(`Inserted ${res.iterator.key}`); // prints 1
}</code></pre>
    </div>
</div>

  

  
  
</div>
<div class="detail" data-ice="detail">
  <h3 data-ice="anchor" id="instance-method-insertUnique">
    <span class="access" data-ice="access">public</span>
    
    
    
    
    
    <span class="code" data-ice="name">insertUnique</span><span class="code" data-ice="signature">(key: <span>*</span>): <span><a href="class/src/public/insertion-result.js~InsertionResult.html">InsertionResult</a></span></span>
    <span class="right-info">
      
      
      <span data-ice="source"><span><a href="file/src/public/tree-set.js.html#lineNumber327">source</a></span></span>
    </span>
  </h3>

  
  
  
  <div data-ice="description"><p>Adds a key if it doesn&apos;t exist</p>
</div>

  

  <div data-ice="properties"><div data-ice="properties">
  <h4 data-ice="title">Params:</h4>
  <table class="params">
    <thead>
    <tr><td>Name</td><td>Type</td><td>Attribute</td><td>Description</td></tr>
    </thead>
    <tbody>
    
    <tr data-ice="property" data-depth="0">
      <td data-ice="name" class="code" data-depth="0">key</td>
      <td data-ice="type" class="code"><span>*</span></td>
      <td data-ice="appendix"></td>
      <td data-ice="description"></td>
    </tr>
</tbody>
  </table>
</div>
</div>

  <div class="return-params" data-ice="returnParams">
    <h4>Return:</h4>
    <table>
      <tbody>
        <tr>
          <td class="return-type code" data-ice="returnType"><span><a href="class/src/public/insertion-result.js~InsertionResult.html">InsertionResult</a></span></td>
          <td class="return-desc" data-ice="returnDescription"><p>indicates whether a node was added and provides iterator to it.</p>
</td>
        </tr>
      </tbody>
    </table>
    <div data-ice="returnProperties">
</div>
  </div>

  

  

  

  

  <div data-ice="example">
    <h4>Example:</h4>
    
  <div class="example-doc" data-ice="exampleDoc">
      
      <pre class="prettyprint source-code"><code data-ice="exampleCode">let set = new TreeSet();
let res = set.insertUnique(1);
if (res.wasInserted) {
  console.log(`Inserted ${res.iterator.key}`); // prints 1
}
res = set.insertUnique(1); // this step has no effect on the set
if (res.wasInserted) {
  console.log(`Inserted ${res.iterator.key}`); // not executed
}</code></pre>
    </div>
</div>

  

  
  
</div>
<div class="detail" data-ice="detail">
  <h3 data-ice="anchor" id="instance-method-keys">
    <span class="access" data-ice="access">public</span>
    
    
    
    
    
    <span class="code" data-ice="name">keys</span><span class="code" data-ice="signature">(): <span><a href="class/src/public/js-iterators.js~JsIterator.html">JsIterator</a></span></span>
    <span class="right-info">
      
      
      <span data-ice="source"><span><a href="file/src/public/tree-set.js.html#lineNumber179">source</a></span></span>
    </span>
  </h3>

  
  
  
  <div data-ice="description"><p>Forward ES6 iterator for all keys in ascending order.</p>
</div>

  

  <div data-ice="properties">
</div>

  <div class="return-params" data-ice="returnParams">
    <h4>Return:</h4>
    <table>
      <tbody>
        <tr>
          <td class="return-type code" data-ice="returnType"><span><a href="class/src/public/js-iterators.js~JsIterator.html">JsIterator</a></span></td>
          
        </tr>
      </tbody>
    </table>
    <div data-ice="returnProperties">
</div>
  </div>

  

  

  

  

  <div data-ice="example">
    <h4>Example:</h4>
    
  <div class="example-doc" data-ice="exampleDoc">
      
      <pre class="prettyprint source-code"><code data-ice="exampleCode">// iterate all keys
let set = new TreeSet([1, 2, 3]);
for (let k of set.keys()) {
  console.log(k); // 1, 2, 3
}
// iterate all keys in reverse order
let set = new TreeSet([1, 2, 3]);
for (let k of set.keys().backward()) {
  console.log(k); // 3, 2, 1
}</code></pre>
    </div>
</div>

  

  
  
</div>
<div class="detail" data-ice="detail">
  <h3 data-ice="anchor" id="instance-method-last">
    <span class="access" data-ice="access">public</span>
    
    
    
    
    
    <span class="code" data-ice="name">last</span><span class="code" data-ice="signature">(): <span>*</span></span>
    <span class="right-info">
      
      
      <span data-ice="source"><span><a href="file/src/public/tree-set.js.html#lineNumber474">source</a></span></span>
    </span>
  </h3>

  
  
  
  

  

  <div data-ice="properties">
</div>

  <div class="return-params" data-ice="returnParams">
    <h4>Return:</h4>
    <table>
      <tbody>
        <tr>
          <td class="return-type code" data-ice="returnType"><span>*</span></td>
          <td class="return-desc" data-ice="returnDescription"><p>last element of the container, or undefined if container is empty</p>
</td>
        </tr>
      </tbody>
    </table>
    <div data-ice="returnProperties">
</div>
  </div>

  

  

  

  

  <div data-ice="example">
    <h4>Example:</h4>
    
  <div class="example-doc" data-ice="exampleDoc">
      
      <pre class="prettyprint source-code"><code data-ice="exampleCode">let set = new TreeSet([1, 2, 3]);
let last = set.last(); // 3</code></pre>
    </div>
</div>

  

  
  
</div>
<div class="detail" data-ice="detail">
  <h3 data-ice="anchor" id="instance-method-lowerBound">
    <span class="access" data-ice="access">public</span>
    
    
    
    
    
    <span class="code" data-ice="name">lowerBound</span><span class="code" data-ice="signature">(key: <span>*</span>): <span><a href="class/src/public/iterators.js~Iterator.html">Iterator</a></span></span>
    <span class="right-info">
      
      
      <span data-ice="source"><span><a href="file/src/public/tree-set.js.html#lineNumber395">source</a></span></span>
    </span>
  </h3>

  
  
  
  <div data-ice="description"><p>Iterator pointing to the first element that is not less than specified key. If no such element is found, see end() iterator is returned.</p>
</div>

  

  <div data-ice="properties"><div data-ice="properties">
  <h4 data-ice="title">Params:</h4>
  <table class="params">
    <thead>
    <tr><td>Name</td><td>Type</td><td>Attribute</td><td>Description</td></tr>
    </thead>
    <tbody>
    
    <tr data-ice="property" data-depth="0">
      <td data-ice="name" class="code" data-depth="0">key</td>
      <td data-ice="type" class="code"><span>*</span></td>
      <td data-ice="appendix"></td>
      <td data-ice="description"></td>
    </tr>
</tbody>
  </table>
</div>
</div>

  <div class="return-params" data-ice="returnParams">
    <h4>Return:</h4>
    <table>
      <tbody>
        <tr>
          <td class="return-type code" data-ice="returnType"><span><a href="class/src/public/iterators.js~Iterator.html">Iterator</a></span></td>
          
        </tr>
      </tbody>
    </table>
    <div data-ice="returnProperties">
</div>
  </div>

  

  

  

  

  <div data-ice="example">
    <h4>Example:</h4>
    
  <div class="example-doc" data-ice="exampleDoc">
      
      <pre class="prettyprint source-code"><code data-ice="exampleCode">let set = new TreeSet();
... // add key-value pairs., using numbers as keys
// iterate through all key-value pairs with keys between 0 and 50 inclusive
let from = set.lowerBound(0);
let to = set.upperBound(50);
let it = from;
while (!it.equals(to)) {
  console.log(it.key);
  it.next();
}

let set = new TreeSet();
... // add key-value pairs., using numbers as keys
// iterate through all key-value pairs with keys between 0 and 50 inclusive in reverse order
let from = new ReverseIterator(set.upperBound(50));
let to = new ReverseIterator(set.lowerBound(0));
let it = from;
while (!it.equals(to)) {
  console.log(it.key);
  it.next();
}</code></pre>
    </div>
</div>

  

  
  
</div>
<div class="detail" data-ice="detail">
  <h3 data-ice="anchor" id="instance-method-rbegin">
    <span class="access" data-ice="access">public</span>
    
    
    
    
    
    <span class="code" data-ice="name">rbegin</span><span class="code" data-ice="signature">(): <span><a href="class/src/public/iterators.js~ReverseIterator.html">ReverseIterator</a></span></span>
    <span class="right-info">
      
      
      <span data-ice="source"><span><a href="file/src/public/tree-set.js.html#lineNumber409">source</a></span></span>
    </span>
  </h3>

  
  
  
  <div data-ice="description"><p>Reverse iterator to the last element.</p>
</div>

  

  <div data-ice="properties">
</div>

  <div class="return-params" data-ice="returnParams">
    <h4>Return:</h4>
    <table>
      <tbody>
        <tr>
          <td class="return-type code" data-ice="returnType"><span><a href="class/src/public/iterators.js~ReverseIterator.html">ReverseIterator</a></span></td>
          
        </tr>
      </tbody>
    </table>
    <div data-ice="returnProperties">
</div>
  </div>

  

  

  

  

  <div data-ice="example">
    <h4>Example:</h4>
    
  <div class="example-doc" data-ice="exampleDoc">
      
      <pre class="prettyprint source-code"><code data-ice="exampleCode">let set = new TreeSet();
...
for (let it = set.rbegin(); !it.equals(set.rend()); it.next()) {
  console.log(`key: ${it.key}`);
}</code></pre>
    </div>
</div>

  

  
  
</div>
<div class="detail" data-ice="detail">
  <h3 data-ice="anchor" id="instance-method-rend">
    <span class="access" data-ice="access">public</span>
    
    
    
    
    
    <span class="code" data-ice="name">rend</span><span class="code" data-ice="signature">(): <span><a href="class/src/public/iterators.js~ReverseIterator.html">ReverseIterator</a></span></span>
    <span class="right-info">
      
      
      <span data-ice="source"><span><a href="file/src/public/tree-set.js.html#lineNumber423">source</a></span></span>
    </span>
  </h3>

  
  
  
  <div data-ice="description"><p>Reverse iterator pointing to before the first element.</p>
</div>

  

  <div data-ice="properties">
</div>

  <div class="return-params" data-ice="returnParams">
    <h4>Return:</h4>
    <table>
      <tbody>
        <tr>
          <td class="return-type code" data-ice="returnType"><span><a href="class/src/public/iterators.js~ReverseIterator.html">ReverseIterator</a></span></td>
          
        </tr>
      </tbody>
    </table>
    <div data-ice="returnProperties">
</div>
  </div>

  

  

  

  

  <div data-ice="example">
    <h4>Example:</h4>
    
  <div class="example-doc" data-ice="exampleDoc">
      
      <pre class="prettyprint source-code"><code data-ice="exampleCode">let set = new TreeSet();
...
for (let it = set.rbegin(); !it.equals(set.rend()); it.next()) {
  console.log(`key: ${it.key}`);
}</code></pre>
    </div>
</div>

  

  
  
</div>
<div class="detail" data-ice="detail">
  <h3 data-ice="anchor" id="instance-method-toString">
    <span class="access" data-ice="access">public</span>
    
    
    
    
    
    <span class="code" data-ice="name">toString</span><span class="code" data-ice="signature">(): <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a></span></span>
    <span class="right-info">
      
      
      <span data-ice="source"><span><a href="file/src/public/tree-set.js.html#lineNumber482">source</a></span></span>
    </span>
  </h3>

  
  
  
  <div data-ice="description"><p>Serializes contents of the set in the form {key1,key2,...}</p>
</div>

  

  <div data-ice="properties">
</div>

  <div class="return-params" data-ice="returnParams">
    <h4>Return:</h4>
    <table>
      <tbody>
        <tr>
          <td class="return-type code" data-ice="returnType"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a></span></td>
          
        </tr>
      </tbody>
    </table>
    <div data-ice="returnProperties">
</div>
  </div>

  

  

  

  

  

  

  
  
</div>
<div class="detail" data-ice="detail">
  <h3 data-ice="anchor" id="instance-method-upperBound">
    <span class="access" data-ice="access">public</span>
    
    
    
    
    
    <span class="code" data-ice="name">upperBound</span><span class="code" data-ice="signature">(key: <span>*</span>): <span><a href="class/src/public/iterators.js~Iterator.html">Iterator</a></span></span>
    <span class="right-info">
      
      
      <span data-ice="source"><span><a href="file/src/public/tree-set.js.html#lineNumber454">source</a></span></span>
    </span>
  </h3>

  
  
  
  <div data-ice="description"><p>Iterator pointing to the first element that is greater than key. If no such element is found end() iterator is returned.</p>
</div>

  

  <div data-ice="properties"><div data-ice="properties">
  <h4 data-ice="title">Params:</h4>
  <table class="params">
    <thead>
    <tr><td>Name</td><td>Type</td><td>Attribute</td><td>Description</td></tr>
    </thead>
    <tbody>
    
    <tr data-ice="property" data-depth="0">
      <td data-ice="name" class="code" data-depth="0">key</td>
      <td data-ice="type" class="code"><span>*</span></td>
      <td data-ice="appendix"></td>
      <td data-ice="description"></td>
    </tr>
</tbody>
  </table>
</div>
</div>

  <div class="return-params" data-ice="returnParams">
    <h4>Return:</h4>
    <table>
      <tbody>
        <tr>
          <td class="return-type code" data-ice="returnType"><span><a href="class/src/public/iterators.js~Iterator.html">Iterator</a></span></td>
          
        </tr>
      </tbody>
    </table>
    <div data-ice="returnProperties">
</div>
  </div>

  

  

  

  

  <div data-ice="example">
    <h4>Example:</h4>
    
  <div class="example-doc" data-ice="exampleDoc">
      
      <pre class="prettyprint source-code"><code data-ice="exampleCode">let set = new TreeSet();
... // add key-value pairs., using numbers as keys
// iterate through all key-value pairs with keys between 0 and 50 inclusive
let from = set.lowerBound(0);
let to = set.upperBound(50);
let it = from;
while (!it.equals(to)) {
  console.log(it.key);
  it.next();
}

let set = new TreeSet();
... // add key-value pairs., using numbers as keys
// iterate through all key-value pairs with keys between 0 and 50 inclusive in reverse order
let from = new ReverseIterator(set.upperBound(50));
let to = new ReverseIterator(set.lowerBound(0));
let it = from;
while (!it.equals(to)) {
  console.log(it.key);
  it.next();
}</code></pre>
    </div>
</div>

  

  
  
</div>
<div class="detail" data-ice="detail">
  <h3 data-ice="anchor" id="instance-method-values">
    <span class="access" data-ice="access">public</span>
    
    
    
    
    
    <span class="code" data-ice="name">values</span><span class="code" data-ice="signature">(): <span>JsITerator</span></span>
    <span class="right-info">
      
      
      <span data-ice="source"><span><a href="file/src/public/tree-set.js.html#lineNumber219">source</a></span></span>
    </span>
  </h3>

  
  
  
  <div data-ice="description"><p>Forward ES6 iterator for all keys in ascending order. It is the same as keys() method</p>
</div>

  

  <div data-ice="properties">
</div>

  <div class="return-params" data-ice="returnParams">
    <h4>Return:</h4>
    <table>
      <tbody>
        <tr>
          <td class="return-type code" data-ice="returnType"><span>JsITerator</span></td>
          
        </tr>
      </tbody>
    </table>
    <div data-ice="returnProperties">
</div>
  </div>

  

  

  

  

  <div data-ice="example">
    <h4>Example:</h4>
    
  <div class="example-doc" data-ice="exampleDoc">
      
      <pre class="prettyprint source-code"><code data-ice="exampleCode">// iterate all values
let set = new TreeSet([1, 2, 3]);
for (let v of set.values()) {
  console.log(v); // &apos;1&apos;, &apos;2&apos;, &apos;3&apos;
}
// iterate all values in reverse order
let set = new TreeSet([1, 2, 3]);
for (let v of set.values().backward()) {
  console.log(v); // &apos;3&apos;, &apos;2&apos;, &apos;1&apos;
}</code></pre>
    </div>
</div>

  

  
  
</div>
</div>
</div>

<footer class="footer">
  Generated by <a href="https://esdoc.org">ESDoc<span data-ice="esdocVersion">(1.0.4)</span><img src="./image/esdoc-logo-mini-black.png"></a>
</footer>

<script src="script/search_index.js"></script>
<script src="script/search.js"></script>
<script src="script/pretty-print.js"></script>
<script src="script/inherited-summary.js"></script>
<script src="script/test-summary.js"></script>
<script src="script/inner-link.js"></script>
<script src="script/patch-for-local.js"></script>
</body>
</html>
